package com.optitronics.util;

import java.util.Map;
import java.util.Properties;

import net.sf.jasperreports.engine.JasperPrint;

import org.springframework.web.servlet.view.jasperreports.JasperReportsPdfView;

public class JasperView extends JasperReportsPdfView {

	public static String REPORT_FILE_NAME = "REPORT_FILE_NAME";

	@Override
	protected JasperPrint fillReport(Map<String, Object> model) throws Exception {

		Properties headers = new Properties();
		String fileName = (String) model.get(REPORT_FILE_NAME);
		headers.put("Content-Disposition", "attachment; filename=" + fileName);
		setHeaders(headers);

		return super.fillReport(model);
	}
}
